home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 4 / Precision Software Applications Silver Collection Volume 4 (1993).iso / stats / chadyn.exe / YCOMCM.C < prev    next >
Text File  |  1988-11-29  |  9KB  |  337 lines

  1.  
  2.  
  3. /********************************* YCOMCM.C **********************************/
  4. /********************* (C) 1986,7,8 by JAMES A. YORKE ************************/
  5.  
  6. #include "yinclud.h"
  7.  
  8. #ifdef X11
  9. int    caseColor(CodeName)
  10. char    *CodeName;        /* unused now */
  11. {
  12.     printf("Color is not implemented on X windows yet\n");
  13.     return;
  14. }
  15. #endif
  16.  
  17. #ifdef MS
  18. static long     colorNum = 0L;    /* for background color */
  19. #ifndef unix
  20. #include <dos.h>        /* for int86 */
  21. #endif
  22. int     set_mode(void);    /* prototype */
  23. struct videoconfig      vc;    /* configuration data */
  24.  
  25.  
  26. int     caseColor(CodeName)         /* CM commands */
  27. char    *CodeName;
  28. {
  29.     int     test;
  30. #ifdef IGNORE
  31. /* arguments to _setvideomode() */
  32. #define _DEFAULTMODE    -1    /* restore screen to original mode */
  33. #define _TEXTBW40       0    /* 40 x 25 text, 16 grey */
  34. #define _TEXTC40        1    /* 40 x 25 text, 16/8 color */
  35. #define _TEXTBW80       2    /* 80 x 25 text, 16 grey */
  36. #define _TEXTC80        3    /* 80 x 25 text, 16/8 color */
  37. #define _MRES4COLOR     4    /* 320 x 200, 4 color */
  38. #define _MRESNOCOLOR    5    /* 320 x 200, 4 grey */
  39. #define _HRESBW         6    /* 640 x 200, BW */
  40. #define _TEXTMONO       7    /* 80 x 25 text, BW */
  41. #define _MRES16COLOR    13    /* 320 x 200, 16 color */
  42. #define _HRES16COLOR    14    /* 640 x 200, 16 color */
  43. #define _ERESNOCOLOR    15    /* 640 x 350, BW */
  44. #define _ERESCOLOR      16    /* 640 x 350, 4 or 16 color */
  45. #define _VRES2COLOR     17    /* 640 x 480, BW */
  46. #define _VRES16COLOR    18    /* 640 x 480, 16 color */
  47. #define _MRES256COLOR   19    /* 320 x 200, 256 color */
  48. /* universal color values: */
  49. #define _BLACK          0x000000L
  50. #define _BLUE           0x2a0000L
  51. #define _GREEN          0x002a00L
  52. #define _CYAN           0x2a2a00L
  53. #define _RED            0x00002aL
  54. #define _MAGENTA        0x2a002aL
  55. #define _BROWN          0x00152aL
  56. #define _WHITE          0x2a2a2aL
  57. #define _GRAY           0x151515L
  58. #define _LIGHTBLUE      0x3F1515L
  59. #define _LIGHTGREEN     0x153f15L
  60. #define _LIGHTCYAN      0x3f3f15L
  61. #define _LIGHTRED       0x15153fL
  62. #define _LIGHTMAGENTA   0x3f153fL
  63. #define _LIGHTYELLOW    0x153f3fL
  64. #define _BRIGHTWHITE    0x3f3f3fL
  65.     EXTERN int      corerows INITIAL(COREROWS);
  66.     EXTERN int      corecols INITIAL(CORECOLS);
  67.     EXTERN int      scrnrows INITIAL(SCRNROWS);
  68.     EXTERN int      scrncols INITIAL(SCRNCOLS);
  69. #define CORECOLS 960        /* Width of the internal memory's picture = */
  70.  /*  The number of bits wide =              */
  71.  /*   width in bits of the printer output   */
  72. #define SCRNCOLS 640        /* Width of the crt screen.  The program
  73.                    assumes this is no bigger than CORECOLS */
  74. #define COREROWS 68        /*  About the max num of printer lines   */
  75.  /* that are permited in 64 K      */
  76. #define SCRNROWS 200        /* height(bits) of crt screen    */
  77. #endif                /* IGNORE */
  78. #endif                /* MS */
  79. #ifndef MAINFRAME
  80. #ifdef MS
  81.     TEST("psm")/*  printer sub menu */
  82.     {
  83.         PSMenu();
  84.         return(1);
  85.     }
  86.     TEST("cim")/*  color interrupt menu */
  87.     {
  88.         CIMenu();
  89.         return(1);
  90.     }
  91.     TEST("setmode")/* this resets the original wakeup mode of the program*/
  92.     {
  93.         SetVidMode();
  94.         ScreenConstants();
  95.         return(1);
  96.     }
  97.     TEST("ega")/* experimental for EGA boards */
  98.     {
  99.         _setvideomode(15);
  100.         scrnrows = 350;
  101.         scrncols = 640;
  102.         _getvideoconfig(&vc); /* put videoconfig data in vc */
  103.         ScreenConstants();
  104.         return(1);
  105.     }
  106.     TEST("black")/* sets backgound color */
  107.     {
  108.         _setbkcolor(0L);/* This sets the background color; the 
  109.             command to black; "setbkcolor" sets 
  110.             the background color */
  111.         return(1);
  112.     }
  113.     TEST("80")/* sets printer */
  114.     {
  115.         printMode = EPSONBW;
  116.         return(1);
  117.     }
  118.     TEST("spacing") {    /* sets printer */
  119.         printerSpacing = (int) Entervalue((double) printerSpacing, CHECKSET);
  120.         return(1);
  121.     }
  122.     TEST("2500") {        /* sets printer */
  123.         printMode = EPSONCOLOR;
  124.         return(1);
  125.     }
  126.     TEST("width") {    /* sets printer */
  127.         test = corecols;
  128.         test = (int) Entervalue((double) test, CHECKSET);
  129.         if(test >= 48 && test < CORECOLS) {
  130.             corecols = test;
  131.             ScreenConstants();
  132.         }
  133.         else
  134.             PRINT
  135.                 "Not acceptable; must be between 48 and %d   \n", COREROWS);
  136.         return(1);
  137.     }
  138.     TEST("height") {    /* sets printer */
  139.         PRINT
  140.             "height must be a multiple of 8 or it will be rounded down\n");
  141.         test = corerows * 8;
  142.         test = (int) Entervalue((double) test, CHECKSET);
  143.         if(test >= 48 && test < 8 * COREROWS) {
  144.             corerows = test / 8;
  145.             ScreenConstants();
  146.         }
  147.         else
  148.             PRINT
  149.                 "Not acceptable; must be between 48 and %d   \n", 8 * COREROWS);
  150.         return(1);
  151.     }
  152.  
  153.     TEST("setbkcolor") {    /* sets backgound color */
  154.         colorNum = (long) Entervalue((double) colorNum, CHECKSET);
  155.         if(level >= PROCESS) {
  156.             turnoff(BIGCROSS);
  157.             turnoff(SMALLCROSS);
  158.             color = colorNum;
  159.             scr_rowcol(1, 5);
  160.             if(printer >= 2)
  161.                 PRINT "new BACKGROUND color = %ld   \n"
  162.                     ,colorNum);
  163.         }
  164.         _setbkcolor(colorNum);
  165.                 /* This sets the background color; the command
  166.                    to black; "setbkcolor" sets the background
  167.                    color */
  168.         if(level >= PROCESS) {
  169.             SetCross(SMALLCROSS);
  170.             turnoff(SMALLCROSS);
  171.             SetCross(SMALLCROSS);
  172.         }
  173.         return(1);
  174.     }
  175.     TEST("egacolor")/* experimental for EGA boards */
  176.     {
  177.         /* first try higher res modes */
  178.         _setvideomode(16);
  179.         scrnrows = 350;
  180.         scrncols = 640;
  181.         _getvideoconfig(&vc); /* put videoconfig data in vc */
  182.         _setcolor((color=12));/* 12 = light red
  183.         _setbkcolor(1L);/* This sets the background color; the command 
  184.           "BLACK" sets the background back to black; "setbkcolor" sets 
  185.            the background color; 1 = blue */
  186.         ScreenConstants();
  187.         return(1);
  188.     }
  189.     TEST("color")
  190.     {
  191.         if (colorGraphics() == 0)/* in YSCREEN.C */
  192.             return (1);/* could not change mode */
  193.         _getvideoconfig(&vc); /* put videoconfig data in vc */
  194.         _setcolor((color=2));/*
  195.         _setbkcolor(1L);/* This sets the background color; the command 
  196.           "BLACK" sets the background back to black; "setbkcolor" sets 
  197.            the background color; 1 = blue */
  198.         ScreenConstants();
  199.         return(1);
  200.     }
  201.     TEST("cga")/* experimental for EGA boards */
  202.     {
  203.         scrnrows = 200;
  204.         scrncols = 640;
  205.         _setvideomode(6);
  206.         _getvideoconfig(&vc); /* put videoconfig data in vc */
  207.         ScreenConstants();
  208.         return(1);
  209.     }
  210.     TEST("cgacolor")/* experimental for EGA boards */
  211.     {
  212.         _setvideomode(4);/* 320 x 200, 4 color */
  213.         scrnrows = 200;
  214.         scrncols = 320;
  215.         _getvideoconfig(&vc); /* put videoconfig data in vc */
  216.         ScreenConstants();
  217.         return(1);
  218.     }
  219.     TEST("prnoff")
  220.     {
  221.         prnFlag = OFF;
  222.         return(1);
  223.     }
  224.     TEST("f9")
  225.     {
  226.         f9();
  227.         return(1);
  228.     }
  229.     TEST("prnon")
  230.     {
  231.         prnFlag = ON;
  232.         return(1);
  233.     }
  234.     return(0);
  235. #endif
  236. #endif
  237. }
  238.  
  239. ColorMenu() {
  240.     if(level == SETPARAM)
  241.         scr_clr();    /* in desmets pcio.a */
  242.     scr_rowcol(0, 2);
  243. #ifdef X11
  244.     PRINT "COLOR IS NOT AVAILABLE WITH THIS VERSION \n");
  245. #endif
  246. #ifdef MS
  247.     PRINT
  248.         "             COLOR SCREEN MENU    \n\n");
  249.     PRINT
  250.         "This program supports several graphics boards:\n");
  251.     PRINT
  252.         "       CGA 640X200 in black/white or 320X200 with 4 colors(incl B/W)\n");
  253.     PRINT
  254.         "       HERCULES   720X348 in black/white\n");
  255.  
  256. PRINT 
  257. "       EGA    640X350 in up to 16 colors\n");
  258. PRINT 
  259. "       VGA   640X480 in 16 colors or 320X200 in 256 colors\n\n");
  260.  
  261. /*    PRINT 
  262. " BLACK:        Sets background color to black \n");
  263.     PRINT 
  264. " SETBKCOLOR:   SET BacKground COLOR -does not seem to work\n");
  265. */
  266.     PRINT 
  267. "more colors? \n");
  268.     PRINT 
  269. " COLOR:     320X200 in more colors: \n");
  270.     PRINT "         2 colors in CGA and 256 in VGA\n");
  271.     PRINT "         interrupt 'Z' cycles through 4 palettes for CGA\n");
  272.     PRINT 
  273. " SETMODE:       SETs the original screen MODE - undoes COLOR \n");
  274.     PRINT 
  275. " Q:    set color table -- VGA color monitors only\n\n");
  276.     PRINT 
  277. "SUBMENUS\n");
  278.     PRINT 
  279. " PSM:  Printer Sub Menu      \n");
  280.     PRINT 
  281. " CIM:  Color Interrupt submenu\n");
  282.  
  283.  
  284. #endif
  285. }
  286.  
  287. PSMenu()/* Printer Sub Menu */
  288. {
  289.     PRINT 
  290. "\n\n              PRINTER SUB MENU \n\n");
  291.     PRINT 
  292. " 80:   says you have an Epson MX 80 or compatible printer (= default)\n");
  293.     PRINT 
  294. " 2500: says you have an Epson MX 2500 COLOR printer\n");
  295. PRINT 
  296. "SPACING: Sets printer spacing between graphics lines (default 24) now=  %d\n",
  297. printerSpacing);
  298. PRINT 
  299. " WIDTH: Number of dots wide the internal core picture should be, now %d\n",
  300. corecols);
  301. PRINT 
  302. " HEIGHT: Number of dots high the internal core picture should be, now %d\n",
  303. corerows*8);
  304.  
  305. /**********************
  306.     PRINT 
  307. " PRNON:        PRiNter ON-- text to printer instead of plotting screen\n");
  308.     PRINT 
  309. " PRNOFF:       return to normal mode, sending text to plotting screen\n");
  310. PRINT " \n");
  311. ***********************/
  312. }
  313.  
  314. CIMenu()/* Color Interrupt Menu */
  315. {
  316.     PRINT 
  317. "\n\n                COLOR INTERRUPT MENU \n\n");
  318.     PRINT
  319. " interrupt  Q:  change color table -- VGA only \n");
  320.     PRINT
  321. " interrupt  F5: interrupt i and then decrease number of color by 1 \n");
  322.     PRINT
  323. " interrupt  F6: interrupt i and then increase number of color by 1 \n");
  324.     PRINT
  325. " interrupt  F7: decrease number of color by 1 \n");
  326.     PRINT
  327. " interrupt  F8: increase number of color by 1\n");
  328.     PRINT
  329. " interrupt  F9: then enter integer value of color, then hit <Enter>\n");
  330. /*    PRINT
  331. "Current number of color planes = %d\n",colorPlanes);
  332. */
  333. }
  334.  
  335.  
  336.  
  337.